package com.cskaoyan.service.wx.impl;
import com.cskaoyan.bean.pojo.User;
import com.cskaoyan.bean.wx.address.AddressDeleteBo;
import com.cskaoyan.bean.wx.address.AddressDetailVo;
import com.cskaoyan.bean.wx.address.AddressListVo;
import com.cskaoyan.bean.wx.address.AddressSaveBo;
import com.cskaoyan.mapper.AddressMapper;
import com.cskaoyan.mapper.RegionMapper;
import com.cskaoyan.mapper.UserMapper;
import com.cskaoyan.service.wx.WxAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

//向磊

@Service
public class WxAddressServiceImpl implements WxAddressService {

    @Autowired
    UserMapper userMapper;
    @Autowired
    AddressMapper addressMapper;
    @Autowired
    RegionMapper regionMapper;


    @Override//wx/address/list
    public List<AddressListVo> addressList(User user ) {

        int userId = userMapper.select1();
        List<AddressListVo> list = addressMapper.select2(userId);
        return list;
    }

    @Override//wx/address/detail
    public AddressDetailVo addressDetail(Integer id) {
        AddressDetailVo data2 = addressMapper.select(id);
        return data2;
    }

    @Override//wx/address/save
    public void addressSave(AddressSaveBo addressSaveBo) {
        addressMapper.update(addressSaveBo);
    }

    @Override//wx/address/delete
    public void addressDelete(AddressDeleteBo addressDeleteBo) {
        addressMapper.delete(addressDeleteBo.getId());
    }




}
